import { defHttp } from '@/utils/http/axios';
import {
  IAssignPackageData,
  IGetConvertibleSkusData,
  IOrderUsageResult,
  IPhoneAuthListResult,
  INumberListResult,
  IMobileCardAddData
} from './type';

const root = '/admin/';

enum Api {
  phoneAuthList = root + 'org/phone-verify-order/pageList',
  queryOrderList = root + 'org/phone-verify-order/queryOrderList',
  getConvertibleSkus = root + 'org/phone-verify-order/getConvertibleSkus',
  getOrderUsage = root + 'org/phone-verify-order/getOrderUsage',
  assignPackage = root + 'org/phone-verify-order/assignPackage',
  numberList = '/im/social/worker/choose/number/list',
  mobileCardAdd = '/im/social/worker/op/add',
  mobileCardPageList = '/im/social/worker/op/pageList',
}

/** 手机快速验证列表 */
export function PhoneAuthList(params) {
  return defHttp.get<IPhoneAuthListResult[]>({
    url: Api.phoneAuthList,
    params,
  });
}

/** 订单列表 */
export function QueryOrderList() {
  return defHttp.get({
    url: Api.queryOrderList,
  });
}

/** 查询可分配的sku列表 */
export function ConvertibleSkus(params: IGetConvertibleSkusData) {
  return defHttp.get({
    url: Api.getConvertibleSkus,
    params,
  });
}

/** 查询订单总量和已用 */
export function OrderUsage() {
  return defHttp.get<IOrderUsageResult>({
    url: Api.getOrderUsage,
  });
}

/** 服务商分配资源包 */
export function AssignPackage(data: IAssignPackageData) {
  return defHttp.post({
    url: Api.assignPackage,
    data,
  });
}

/** 获取可选号码列表 */
export function NumberList(params?) {
  return defHttp.get<INumberListResult>({
    url: Api.numberList,
    params,
  });
}

/** 移动卡领取确认 */
export function MobileCardAdd(data: IMobileCardAddData) {
  return defHttp.post({
    url: Api.mobileCardAdd,
    data,
  });
}

/** 移动卡申请分页列表 */
export function MobileCardPageList(params) {
  return defHttp.get({
    url: Api.mobileCardPageList,
    params,
  });
}
